package com.transitionseverywhere.extra;

import android.animation.Animator;
import android.content.Context;
import android.graphics.PointF;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import com.transitionseverywhere.Transition;
import com.transitionseverywhere.TransitionValues;
import com.transitionseverywhere.utils.AnimatorUtils;
import com.transitionseverywhere.utils.PointFProperty;

/* loaded from: classes.dex */
public class TranslationTransition extends Transition {
    private static final PointFProperty<View> TRANSLATION_PROPERTY;
    private static final String TRANSLATION_X = "TranslationTransition:translationX";
    private static final String TRANSLATION_Y = "TranslationTransition:translationY";

    static {
        if (Build.VERSION.SDK_INT >= 14) {
            TRANSLATION_PROPERTY = new PointFProperty<View>() { // from class: com.transitionseverywhere.extra.TranslationTransition.1
                @Override // android.util.Property
                public void set(View view, PointF pointF) {
                    view.setTranslationX(pointF.x);
                    view.setTranslationY(pointF.y);
                }

                @Override // com.transitionseverywhere.utils.PointFProperty, android.util.Property
                public PointF get(View view) {
                    return new PointF(view.getTranslationX(), view.getTranslationY());
                }
            };
        } else {
            TRANSLATION_PROPERTY = null;
        }
    }

    public TranslationTransition() {
    }

    public TranslationTransition(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    private void captureValues(TransitionValues transitionValues) {
        if (transitionValues.view != null) {
            transitionValues.values.put(TRANSLATION_X, Float.valueOf(transitionValues.view.getTranslationX()));
            transitionValues.values.put(TRANSLATION_Y, Float.valueOf(transitionValues.view.getTranslationY()));
        }
    }

    @Override // com.transitionseverywhere.Transition
    public void captureStartValues(TransitionValues transitionValues) {
        captureValues(transitionValues);
    }

    @Override // com.transitionseverywhere.Transition
    public void captureEndValues(TransitionValues transitionValues) {
        captureValues(transitionValues);
    }

    @Override // com.transitionseverywhere.Transition
    public Animator createAnimator(ViewGroup viewGroup, TransitionValues transitionValues, TransitionValues transitionValues2) {
        if (transitionValues == null || transitionValues2 == null || TRANSLATION_PROPERTY == null) {
            return null;
        }
        return AnimatorUtils.ofPointF(transitionValues2.view, TRANSLATION_PROPERTY, getPathMotion(), ((Float) transitionValues.values.get(TRANSLATION_X)).floatValue(), ((Float) transitionValues.values.get(TRANSLATION_Y)).floatValue(), ((Float) transitionValues2.values.get(TRANSLATION_X)).floatValue(), ((Float) transitionValues2.values.get(TRANSLATION_Y)).floatValue());
    }
}
